package com.alibaba.algo.cooperation.usercomponent.service.user;

import com.alibaba.algo.cooperation.common.BaseResult;
import com.alibaba.algo.cooperation.usercomponent.vo.req.user.SelectResourceActionListByRoleReqVO;
import com.alibaba.algo.cooperation.usercomponent.vo.req.user.SelectResourceListByRoleReqVO;
import com.alibaba.algo.cooperation.usercomponent.vo.req.user.UpdateRoleResourceActionVO;
import com.alibaba.algo.cooperation.usercomponent.vo.res.user.ResourceActionInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;

/**
 * 类SysEmployeeGroupService.java的实现描述：用户组关系表 service
 *
 * @author fan.tianpeng 2021-05-06 20:30:48
 */
@FeignClient(url="${feign.userCenterUrl:}", value = "usercenter-service", contextId = "usercenter-app")
public interface SysRoleResourceActionService {

    @RequestMapping(value="/sysRoleResourceAction/updateResourceActionListByRole",method = RequestMethod.POST)
    BaseResult updateResourceActionListByRole(@RequestParam(value = "roleCode")String roleCode,
                                              @RequestParam(value = "appCode") String appCode,
                                              @RequestParam(value = "resourceIds") String resourceIds,
                                              @RequestBody HashMap<Long, ResourceActionInfo> newResourceActionMap);


    @RequestMapping(value="/sysRoleResourceAction/insert",method = RequestMethod.POST)
    BaseResult insert(@RequestBody UpdateRoleResourceActionVO vo);


    @RequestMapping(value="/sysRoleResourceAction/delete",method = RequestMethod.POST)
    BaseResult delete(@RequestBody UpdateRoleResourceActionVO vo);

    @RequestMapping(value = "/sysRoleResourceAction/selectResourceActionTree", method = RequestMethod.POST)
    BaseResult selectResourceActionTree(@RequestParam(value="appCode") String appCode);

    /**
     * 根据角色查询其拥有的资源动作组
     */
    @RequestMapping(value = "/sysRoleResourceAction/selectResourceActionListByRole", method = RequestMethod.POST)
    BaseResult selectResourceActionListByRole(@RequestBody SelectResourceActionListByRoleReqVO vo);

    @RequestMapping(value = "/sysRoleResourceAction/selectResourceListByRole", method = RequestMethod.POST)
    BaseResult selectResourceListByRole(@RequestBody SelectResourceListByRoleReqVO vo);
}